package com.feng.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.feng.entity.Article;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ArticleListVo {

    private String id;

    private String title;

    private String summary;
    //所属分类ID
    private Long categoryId;

    private String categoryName;

    private String thumbnail;

    private Long viewCount;

    @JsonFormat(pattern = "yyyy年MM月dd日")
    private Date createTime;

    public ArticleListVo(Article article, Long viewCount){
        this.id = article.getId();
        this.title = article.getTitle();
        this.summary = article.getSummary();
        this.viewCount = viewCount;
    }
}
